/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 666
 * Date: 2023-04-15
 * Time: 9:07
 */
import java.util.*;

 class Gift {
    public int getValue(int[] gifts, int n) {
        // write code here
        int[] arr =new int[1000000];
        for (int i = 0; i < n; i++) {
            arr[gifts[i]]++;
        }
        for (int i = 0; i < n; i++) {
           if(n%2!=0){
               if (arr[i]>n/2 + 1){
                   return arr[i];
               }
           }else {
               if(arr[i]>n/2){
                   return arr[i];
               }
           }
        }
        return 0;
    }
}
public class test1 {
    public static void main(String[] args) {

    }
}
